package javaCode.chapter13.map_;

import java.util.HashMap;
import java.util.Objects;

/**
 * @author 徐州城
 * @version 1.0
 */
@SuppressWarnings("all")
public class HashMapSource2 {
    public static void main(String[] args) {
        HashMap hashMap = new HashMap();
        for (int i = 1; i < 13; i++) {
            hashMap.put(new A(i), "hello");
        }

        System.out.println("hashMap=" + hashMap);

        //布置一个任务，自己设计代码去验证，table的扩容
        //0->16(12) -> 32(24) -> 64(48) -> 128(96)
    }
}

class A {
    private int num;

    public A(int num) {
        this.num = num;
    }

    //所有的hashCode都是100
//    @Override
//    public int hashCode() {
//        return 100;
//    }

    @Override
    public String toString() {
        return "\nA{" +
                "num=" + num +
                '}';
    }
}